package com.kaili.db.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kaili.pojo.entity.HsEwbsTransferDetail;
import com.kaili.db.mapper.HsEwbsTransferDetailMapper;
import com.kaili.db.service.IHsEwbsTransferDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cgm
 * @since 2018-05-08
 */
@Service
public class HsEwbsTransferDetailServiceImpl extends ServiceImpl<HsEwbsTransferDetailMapper, HsEwbsTransferDetail> implements IHsEwbsTransferDetailService {

    @Autowired
    HsEwbsTransferDetailMapper transferDetailMapper;
    @Override
    public boolean hasTransed(HsEwbsTransferDetail detail) {
        Map search = new HashMap();
        search.put("ewb_no", detail.getEwbNo());
        search.put("site_id", detail.getSiteId());
        search.put("rd_status", 1);
        List<HsEwbsTransferDetail> lst = baseMapper.selectByMap(search);
        if (lst != null && lst.size() > 0) {
            return true;
        }
        return false;
    }

    public boolean insertBatch(List<HsEwbsTransferDetail> list){
        transferDetailMapper.insertBatch(list);
        return true;
    }

    @Override
    public void updateTrans(Map map) {
        transferDetailMapper.updateTrans(map);
    }
}
